<?php
echo ('
<!DOCTYPE html>
<html>
 <head>
 	<title>
 	Создать город в базе данных
 	</title>
   <link rel="shortcut icon" type="image/ico" href="images/favicon1.ico" />
   <meta charset="utf-8">
 </head>
 <body>
<h1>Добавить город</h1>
<form name="" action="" method="post">
	<input name="table" type="text" value=""><input type="submit" value="Send" name="makeCity">
</form>
');
include('../class/class_connect.php');
$table=$_POST['table'];
if($_POST['makeCity'])
{

	$aConnect=new connect('m');
	$query="CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	rating VARCHAR(255) NOT NULL,
	votes VARCHAR(255) NOT NULL,
	user VARCHAR(255) NOT NULL,
	name VARCHAR(255) NOT NULL,
	short VARCHAR(255) NOT NULL,
	link VARCHAR(255) NOT NULL,
	address VARCHAR(255) NOT NULL,
	positions TEXT NOT NULL,
	phone VARCHAR(255) NOT NULL,
	workdays VARCHAR(255) NOT NULL,
	text_title VARCHAR(255) NOT NULL,
	stext TEXT NOT NULL,
	firms TEXT NOT NULL,
	status VARCHAR(255) NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();
	$structure='../pictures/mallspics/'.$table;
	if(!file_exists($structure))
	{
		if (!mkdir($structure, 0777, true))
	    	die('Не удалось создать директории "pictures/mallspics/'.$table);
	}

 	$aConnect=new connect("ma");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	name VARCHAR(255) NOT NULL,
	stext TEXT NOT NULL,
	malls_id INT(11) NOT NULL,
	malls_name VARCHAR(255) NOT NULL,
	malls_short VARCHAR(255) NOT NULL,
	user VARCHAR(255) NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();
	$structure='../pictures/mallsactspics/'.$table;
	if(!file_exists($structure))
	{
		if (!mkdir($structure, 0777, true))
	    	die('Не удалось создать директории "pictures/mallsactspics/'.$table);
	}

 	$aConnect=new connect("mn");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	name VARCHAR(255) NOT NULL,
	stext TEXT NOT NULL,
	malls_id INT(11) NOT NULL,
	malls_name VARCHAR(255) NOT NULL,
	malls_short VARCHAR(255) NOT NULL,
	user VARCHAR(255) NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();
	$structure='../pictures/mallsnewspics/'.$table;
	if(!file_exists($structure))
	{
		if (!mkdir($structure, 0777, true))
	    	die('Не удалось создать директории "pictures/mallsnewspics/'.$table);
	}

	$aConnect=new connect("mc");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	m_id INT(11) NOT NULL,
	user_name VARCHAR(255) NOT NULL,
	user_status VARCHAR(255) NOT NULL,
	stext TEXT NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();

	$aConnect=new connect("mr");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	firm_id INT(11) NOT NULL,
	rating FLOAT NOT NULL,
	votes INT(11) NOT NULL,
	user VARCHAR(255) NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();

	$aConnect=new connect("f");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	user VARCHAR(255) NOT NULL,
	name VARCHAR(255) NOT NULL,
	short VARCHAR(255) NOT NULL,
	address TEXT NOT NULL,
	positions TEXT NOT NULL,
	link VARCHAR(255) NOT NULL,
	division VARCHAR(255) NOT NULL,
	subdiv VARCHAR(255) NOT NULL,
	text_title VARCHAR(255) NOT NULL,
	stext TEXT NOT NULL,
	malls TEXT NOT NULL,
	rating FLOAT NOT NULL,
	votes INT(11) NOT NULL,
	net_id INT(11) NOT NULL,
	status INT(11) NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();
	$structure='../pictures/firmspics/'.$table;
	if(!file_exists($structure))
	{
		if (!mkdir($structure, 0777, true))
	    	die('Не удалось создать директории "pictures/firmspics/'.$table);
	}

    $aConnect=new connect("fc");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	f_id INT(11) NOT NULL,
	user_name VARCHAR(255) NOT NULL,
	user_status VARCHAR(255) NOT NULL,
	stext TEXT NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();

	$aConnect=new connect("fn");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	name VARCHAR(255) NOT NULL,
	stext TEXT NOT NULL,
	firms_id INT(11) NOT NULL,
	firms_name VARCHAR(255) NOT NULL,
	firms_short VARCHAR(255) NOT NULL,
	user VARCHAR(255) NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();
	$structure='../pictures/firmsnewspics/'.$table;
	if(!file_exists($structure))
	{
		if (!mkdir($structure, 0777, true))
	    	die('Не удалось создать директории "pictures/firmsnewspics/'.$table);
	}


    $aConnect=new connect("fr");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	firm_id INT(11) NOT NULL,
	rating FLOAT NOT NULL,
	votes INT(11) NOT NULL,
	user VARCHAR(255) NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();

    $aConnect=new connect("fa");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	name VARCHAR(255) NOT NULL,
	stext TEXT NOT NULL,
	firms_id INT(11) NOT NULL,
	firms_name VARCHAR(255) NOT NULL,
	firms_short VARCHAR(255) NOT NULL,
	user VARCHAR(255) NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();
	$structure='../pictures/firmsactspics/'.$table;
	if(!file_exists($structure))
	{
		if (!mkdir($structure, 0777, true))
	    	die('Не удалось создать директории "pictures/firmsactspics/'.$table);
	}


	$aConnect=new connect("p");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	firms_id INT(11) NOT NULL,
	stext TEXT NOT NULL,
	tab_name VARCHAR(255) NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();
	$structure='../pictures/pricepics/'.$table;
	if(!file_exists($structure))
	{
		if (!mkdir($structure, 0777, true))
	    	die('Не удалось создать директории "pictures/pricepics/'.$table);
	}

    $aConnect=new connect("pr");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	firms_id INT(11) NOT NULL,
	firms_name VARCHAR(255) NOT NULL,
	photo VARCHAR(255) NOT NULL,
	name VARCHAR(255) NOT NULL,
	brend VARCHAR(255) NOT NULL,
	model VARCHAR(255) NOT NULL,
	price VARCHAR(255) NOT NULL,
	data DATETIME NOT NULL
	);";
	mysql_query($query) or die(mysql_error());
	mysql_close();

	$aConnect=new connect("cs");
	$query="
	CREATE TABLE ".$table." (
	id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	street VARCHAR(255) NOT NULL,
	buildings TEXT NOT NULL
	);";
	mysql_query($query);
	mysql_close();

    echo ('Таблицы успешно созданы!');
}


?>